package com.fileCenter.pojo;

import java.sql.Timestamp;

public class File extends BasePojo {

	private static final long serialVersionUID = 4538973772913430169L;
	
	private Long id;
	private String name;
	private String uploadName;
	private Long space;
	private Timestamp uploadTime;
	private Long parentFileId;
	private Long ownerId;
	private String signKey;
	private int status;
	private Timestamp gmtCreate;
	private Timestamp gmtModify;
	
	public File() {
		super();
	}

	public File(Long id, String name, String uploadName, Long space, Timestamp uploadTime,
			Long parentFileId, Long ownerId, String signKey, int status,
			Timestamp gmtCreate, Timestamp gmtModify) {
		super();
		this.id = id;
		this.name = name;
		this.uploadName = uploadName;
		this.space = space;
		this.uploadTime = uploadTime;
		this.parentFileId = parentFileId;
		this.ownerId = ownerId;
		this.signKey = signKey;
		this.status = status;
		this.gmtCreate = gmtCreate;
		this.gmtModify = gmtModify;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getSpace() {
		return space;
	}

	public void setSpace(Long space) {
		this.space = space;
	}

	public Timestamp getUploadTime() {
		return uploadTime;
	}

	public void setUploadTime(Timestamp uploadTime) {
		this.uploadTime = uploadTime;
	}

	public Long getParentFileId() {
		return parentFileId;
	}

	public void setParentFileId(Long parentFileId) {
		this.parentFileId = parentFileId;
	}

	public Long getOwnerId() {
		return ownerId;
	}

	public void setOwnerId(Long ownerId) {
		this.ownerId = ownerId;
	}

	public String getSignKey() {
		return signKey;
	}

	public void setSignKey(String signKey) {
		this.signKey = signKey;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Timestamp getGmtCreate() {
		return gmtCreate;
	}

	public void setGmtCreate(Timestamp gmtCreate) {
		this.gmtCreate = gmtCreate;
	}

	public Timestamp getGmtModify() {
		return gmtModify;
	}

	public void setGmtModify(Timestamp gmtModify) {
		this.gmtModify = gmtModify;
	}
	
	public String getFileType() {
		int index = name.lastIndexOf(".");
		if (index + 1 < name.length()) {
			String suffix = name.substring(index + 1);
			return FileType.getFileTypeByName(suffix).getName();
		}
		return FileType.TXT.getName();
	}

	public String getUploadName() {
		return uploadName;
	}

	public void setUploadName(String uploadName) {
		this.uploadName = uploadName;
	}
}
  